package com.snpic.appaw.module.third.api.sms;

import com.snpic.appaw.framework.common.pojo.CommonResult;
import com.snpic.appaw.module.third.api.sms.dto.SmsReqDTO;
import com.snpic.appaw.module.third.api.sms.dto.SmsRespDTO;
import com.snpic.appaw.module.third.controller.admin.sms.vo.SmsReqVO;
import com.snpic.appaw.module.third.controller.admin.sms.vo.SmsRespVO;
import com.snpic.appaw.module.third.service.sms.SmsService;
import jakarta.annotation.Resource;
import org.dromara.hutool.core.bean.BeanUtil;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import static com.snpic.appaw.framework.common.exception.util.ServiceExceptionUtil.exception;

/**
 * @author JiJun
 * @date 2025/8/29 14:33
 * @修改时间 2025/8/29 14:33
 * @description
 */
@RestController // 提供 RESTful API 接口，给 Feign 调用
@Validated
public class SmsSenderApiImpl implements SmsSenderApi{
	    @Resource
    private SmsService smsService;

	@Override
	public CommonResult<SmsRespDTO> sendSmsOne( SmsReqDTO reqDTO) {
		SmsReqVO smsReqVO = BeanUtil.copyProperties(reqDTO, SmsReqVO.class);
		SmsRespVO smsRespVO = smsService.sendSmsOne(smsReqVO);
		return CommonResult.success(BeanUtil.copyProperties(smsRespVO, SmsRespDTO.class));
	}
}
